<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>Product - appBuy</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link href="css/style.css" rel="stylesheet" type="text/css" />
        <link rel="stylesheet" type="text/css" href="css/coin-slider.css" />
        <script type="text/javascript" src="js/cufon-yui.js"></script>
        <script type="text/javascript" src="js/droid_sans_400-droid_sans_700.font.js"></script>
        <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
        <script type="text/javascript" src="js/script.js"></script>
        <script type="text/javascript" src="js/coin-slider.min.js"></script>
    </head>
    <%@ include file="../../userBar.jsp" %>
    <%@ include file="../../topBarSlide.jsp" %>
    <%@ include file="../../sideBar.jsp" %>
    <%@page import="java.io.File"%>
    <%@page import="java.util.Map"%>
    <%@page import="model.Product"%>
    <%@page import="java.util.Iterator"%>

    <div class="content">
    <div class="content_resize">
      <div class="mainbar">
          <jsp:useBean id="itr" scope="request" class="Iterator" />

          <%
          while(itr.hasNext()){
              Map.Entry e = (Map.Entry)itr.next();
              request.setAttribute("product", (Product) e.getValue());
          %>
          <jsp:useBean id="product" scope="request" class="model.Product" />
          <div class="article">
           <h2><span><jsp:getProperty name="product" property="nombre" /></span></h2>
          <p class="infopost">Añadida <span class="date">el <jsp:getProperty name="product" property="fecha" /></span> por <a href="/Appbuy/FrontController?form=readUserServlet&userName=<jsp:getProperty name="product" property="usuario" />"><jsp:getProperty name="product" property="usuario" /></a><a href="#" class="com"><b>Precio: <span><jsp:getProperty name="product" property="precio" /> €</span></b></a></p>
          <div class="clr"></div>
          <div class="post_content"><br>
              <b>· Sistema Operativo:</b> <jsp:getProperty name="product" property="so" /><br><br>
              <b>· Ventas:</b> <jsp:getProperty name="product" property="ventas" /><br><br>
              <b>· Breve descripcion:</b> <jsp:getProperty name="product" property="descripcionc" /><br><br>
              <b> · Descripcion:</b> <jsp:getProperty name="product" property="descripcionl" /><br><br>
          </div>
          <%

          String path= request.getServletContext().getRealPath("../../web") + "/images\\APP_" + product.getNombre()+'_'+product.getSo()+".jpg";
          File f = new File(path);
          if (f.exists()){
          %>
          <div class="img"><img src="images/APP_<jsp:getProperty name="product" property="nombre" />_<jsp:getProperty name="product" property="so" />.jpg" width="150" height="150" alt="" class="fl" /></div>
          <%}else{%>
          <div class="img"><img src="images/OS_<jsp:getProperty name="product" property="so" />.png" width="150" height="150" alt="" class="fl" /></div>
          <%}%>
          <p class="spec"><a href="/Appbuy/FrontController?form=addToCarritoServlet&nombre=<jsp:getProperty name="product" property="id" />" class="rm">AL CARRITO</a></p>
          <div class="clr"></div>
        </div>
          <%}%>
      </div>
      <div class="clr"></div>
    </div>
  </div>
          <%@ include file="../../bottomBar.jsp" %>
</html>
